AC_PREREQ([2.57])
AC_INIT(ballz, 1.0.2)
AC_CONFIG_HEADERS([src/config.hpp])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE

AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
#AC_LANG_CPLUSPLUS

AC_HEADER_DIRENT
AC_HEADER_STDC

AM_PATH_ALLEGRO(4.2.0, , AC_MSG_ERROR([Allegro library not found! You can get a copy at http://www.talula.demon.co.uk/allegro/]))

CFLAGS="$CFLAGS `allegro-config --cflags`  -Wno-missing-declarations  -ffast-math"
CPPFLAGS="$CPPFLAGS `allegro-config --cppflags` -ffast-math"
LIBS="`allegro-config --libs` $LIBS"

CXXFLAGS="$CXXFLAGS -DALLEGRO_USE_CONSOLE -DBALLZ_DATA_PREFIX='\"$datadir/ballz\"'" 

AC_CHECK_LIB([guichan], [gcnGuichanVersion], LIBS="-lguichan -lguichan_allegro $LIBS",
  AC_MSG_ERROR([Could not find lib Guichan >= 0.8 (guichan.sf.net)!]))

AC_CHECK_LIB([dumb], [dumb_register_stdfiles], LIBS="-ldumb -laldmb $LIBS",
  AC_MSG_ERROR([Could not find lib Dumb (dumb.sf.net)!]))

AC_OUTPUT([
Makefile
data/Makefile
desktop/Makefile
src/Makefile
])
